package edu.gdut.tiantian.service.Impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;

import edu.gdut.tiantian.dao.ProductDao;
import edu.gdut.tiantian.entity.Product;
import edu.gdut.tiantian.service.IProductService;
@Service
public class ProductService implements IProductService{
	
	@Autowired
	private ProductDao productDao;
	
	@Override
	public void save(Product product) {
		productDao.save(product);
	}

	@Override
	public void delete(String productId) {
		productDao.delete(productId);
	}

	@Override
	public void update(Product product) {
		productDao.update(product);
	}

	@Override
	public Product findById(String productId) {
		return productDao.findById(productId);
	}

	@Override
	public List<Product> findByCondition(Map<String, String> condition, int pageNum,int size) {
		PageHelper.startPage(pageNum, size);
		return productDao.findByCondition(condition);
	}

	@Override
	public List<Product> getCommend() {
		return productDao.getCommend();
	}

	@Override
	public List<Product> getNew() {
		return productDao.getNew();
	}

}
